#e
#Title[ᐯuBX^[NX}X-Lunatic-v]
#Text[G@Lu`mv]
#ScriptVersion[2]
#PlayLevel[Lunatic]
#Player[FREE]

script_enemy_main {
 let img = "script\img\ExRumia.png";
 let name = "ᐯuBX^[NX}Xv";

 @Initialize {
  CutIn(KOUMA, name, "", 0, 0, 0, 0);
  SetX(GetCenterX);
  SetY(GetCenterY - 120);
  SetLife(3000);
  SetScore(1000000);

  LoadGraphic(img);
  SetTexture(img);
  SetGraphicRect(64, 0, 128, 64);

  TMain;
 }

 @MainLoop {
  SetCollisionA(GetX, GetY, 24);
  SetCollisionB(GetX, GetY, 24);

  yield;
 }

 @DrawLoop {
  DrawGraphic(GetX, GetY);
 }

 @Finalize {
  DeleteGraphic(img);
 }

 task TMain {
  yield;

  TStar;
  TMove;
  TSstar
 }

 task TStar {
  yield;

  loop {
   loop(5) { yield; }
   CreateShot01(rand(GetClipMinX, GetClipMaxX), GetClipMinY, 0.8, rand(45, 135), WHITE11, 0);
  }
 }

 task TMove {
  yield;

  loop {
   loop(10) { yield; }
   moveX(rand(-100, 100), 120);
   loop(120) { yield; }
  }
 }

 task TSstar {
  let angle = 45;
  let angle2 = 75;
  let angle3 = 105;
  yield;

  loop {
   loop(120) { yield; }
   CreateShot01(GetX, GetY, 1.5, angle, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle, BLUE03, 15);
   CreateShot01(GetX, GetY, 1.5, angle + 1.5, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle - 1.5, BLUE03, 0);
   angle = rand(45, 70);
   CreateShot01(GetX, GetY, 1.5, angle2, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle2, BLUE03, 15);
   CreateShot01(GetX, GetY, 1.5, angle2 + 1.5, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle2 - 1.5, BLUE03, 0);
   angle2 = rand(75, 100);
   CreateShot01(GetX, GetY, 1.5, angle3, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle3, BLUE03, 15);
   CreateShot01(GetX, GetY, 1.5, angle3 + 1.5, BLUE03, 0);
   CreateShot01(GetX, GetY, 1.5, angle3 - 1.5, BLUE03, 0);
   angle3 = rand(105, 135);
   loop(20) { yield; }
   CreateLaser01(GetClipMaxX, rand(GetClipMinY, GetCenterY), 2.5, rand(135, 160), 200, 10, WHITE11, 0);
   CreateLaser01(GetClipMaxX, rand(GetClipMinY, GetCenterY), 3, rand(135, 160), 200, 10, WHITE11, 0);
   CreateLaser01(GetClipMaxX, rand(GetClipMinY, GetCenterY), 3.5, rand(135, 160), 200, 10, WHITE11, 0);
  }
 }

 function moveX(xMove, frame) {
  let x;

  x = GetX + xMove;
  if(x < GetClipMinX + 20) {
   x = GetClipMinX + 40;
  }
  else if(x > GetClipMaxX - 20) {
   x = GetClipMaxX - 40;
  }

  SetMovePosition02(x, GetY, frame);
 }

}